package com.hdd.biz.member.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hdd.biz.member.entity.Member;
import com.hdd.biz.member.entity.MemberBackups;
import com.hdd.biz.member.mapper.MemberBackupsMapper;
import com.hdd.biz.member.service.MemberBackupsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdd.utils.DateUtil;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统用户表 服务实现类
 * </p>
 *
 * @author fang
 * @since 2021-04-13
 */
@Service
public class MemberBackupsServiceImpl extends ServiceImpl<MemberBackupsMapper, MemberBackups> implements MemberBackupsService {


    @Override
    public void insetMember(Member member1) {

        QueryWrapper<MemberBackups> wrapper = new QueryWrapper<>();
        wrapper.eq("xcx_openid",member1.getXcxOpenid());
        MemberBackups memberBackups = baseMapper.selectOne(wrapper);
        if(memberBackups!=null){
            return;
        }

        MemberBackups member = new MemberBackups();
        member.setUserId(member1.getUserId());
        member.setPaintingNum(member1.getPaintingNum());
        member.setXcxOpenid(member1.getXcxOpenid());
        member.setUnionId(member1.getUnionId());
        member.setNickname(member1.getNickname());
        member.setUsername(member1.getUsername());
        member.setPassword(member1.getPassword());
        member.setSecondTime(member1.getSecondTime());
        member.setLastTime(member1.getLastTime());
        member.setCity(member1.getCity());
        member.setProvince(member1.getProvince());
        member.setSex(member1.getSex());
        member.setHeadImgUrl(member1.getHeadImgUrl());
        member.setStatus(1);
        member.setTrustType(1);
        member.setIsReal("F");
        baseMapper.insert(member);
    }

}
